package com.future.bantang.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 16-1-13.
 * 继承此类只需重写instantiateItem方法即可
 */
public class BasePagerAdapter<T> extends PagerAdapter {

    protected List<T> mList;
    protected Context mContext;

    public BasePagerAdapter(Context mContext,List<T> list) {
        this.mContext = mContext;
        this.mList=list;
    }


    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }


    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }



}
